package com.syuson.biz.pay.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.syuson.biz.pay.entity.AllPayInfo;
import com.syuson.common.mybatis.MyBatisDao;

/**
 * 
 * @author syuson
 *
 */
@Service
@Transactional
public class PayInfoService {
	
	@Autowired
	private MyBatisDao myBatisDao;

	public int insert(List<AllPayInfo> allpPayInfoList) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("list", allpPayInfoList);
		return myBatisDao.insert(PayInfoService.class.getName(), "batchInsert", paramMap);
	}

	public int update(List<AllPayInfo> allpPayInfoList) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("list", allpPayInfoList);
		return myBatisDao.update(PayInfoService.class.getName(), "batchUpadte", paramMap);
	}

	public int delete(List<AllPayInfo> allpPayInfoList) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("list", allpPayInfoList);
		return myBatisDao.delete(PayInfoService.class.getName(), "batchDelete", paramMap);
	}

	public AllPayInfo queryById(String id) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("id", id);
		List<AllPayInfo> allpPayInfoList = myBatisDao.findList(PayInfoService.class.getName(), "queryById", paramMap);
		if (allpPayInfoList.size() > 0) {
			return (AllPayInfo) allpPayInfoList.get(0);
		}
		return null;
	}
}
